package com.bjwl.web.contrlller.branchstore;

import com.bjwl.pojo.*;
import com.bjwl.pojo.vo.CardQueryVo;
import com.bjwl.service.AdminCardService;
import com.bjwl.service.BranchStoreCardService;
import com.bjwl.service.BranchStoreService;
import com.bjwl.service.CardDenominationService;
import com.bjwl.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.text.ParseException;
import java.util.List;

/**
 * @Author: dzx
 * @Date:Create：in 2020/5/11 14:11
 * @Description:
 * @Modified By：
 * @Version: 1.0
 */
@Controller
@RequestMapping("/bsfk")
public class BranchStoreCardControllerabc {

    @Autowired
    private BranchStoreCardService branchStoreCardService;


    @RequestMapping("/findBsCardOpen")
    public String findBsCardOpen(HttpSession httpSession, Integer bsid,Integer pageNum,Integer cardtype ,Integer state) {
        if(pageNum == null){
            pageNum =1;
        }

        Bsadmin bsadmin1 = (Bsadmin) httpSession.getAttribute("bsadmin1");
        bsid = bsadmin1.getBsid();
        PageBean<Card> bsCardList = branchStoreCardService.findWorkByBstoreid(pageNum,bsid,cardtype,state);
        httpSession.setAttribute("bsCardList", bsCardList);
        return "branch_oa/cardfk-list";

    }

   /* @RequestMapping("/addCard")
    public @ResponseBody
    boolean addCard(@RequestBody CardQueryVo vo){
        return adminCardService.addCard(vo);
    }

    @RequestMapping("/editS")
    public String editS(Integer id, Model model) throws ParseException {
        Card card = adminCardService.editS(id);
        List<CardDenomination> list = cardDenominationService.findAll();
        model.addAttribute("card",card);
        model.addAttribute("cardD",list);
        return "branch_oa/cardfk-edit";
    }

    @RequestMapping("/editE")
    public @ResponseBody
    boolean editE(@RequestBody Card card){
        return adminCardService.updateCard(card);
    }

    @RequestMapping("/deleteCard")
    public @ResponseBody
    boolean deleteCard(@RequestBody Integer id){
        System.out.println(id+"***************************************");
        return adminCardService.deleteCard(id);
    }*/

}
